package sdk.org.apache.shiro.G2_使用.C10_SpringBoot集成_1登录和退出.services;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.titan.core.apidoc.annotations.ApiAuthor;
import com.titan.core.apidoc.annotations.ApiDescription;
import com.titan.core.apidoc.annotations.ApiEmail;
import com.titan.core.apidoc.annotations.ApiVersion;
import com.titan.core.base.BaseHtmlV8;
import com.titan.core.utils.data.AssertUtils;
import com.titan.core.utils.data.FormatUtils;
import com.titan.core.utils.data.StringUtils;
import com.titan.core.utils.file.JsonUtils;
import com.titan.core.utils.io.ConsoleUtils;
import com.titan.core.web.utils.RequestUtils;
import com.titan.services.GenerateCode.v8.ViewXML.tags.bootstrap4.Bootstrap4ButtonTagV8;
import com.titan.services.GenerateCode.v8.ViewXML.tags.bootstrap4.Bootstrap4CardTagV8;
import com.titan.services.GenerateCode.v8.ViewXML.tags.html.HtmlTagV8;
import com.titan.services.GenerateCode.v8.ViewXML.tags.html5.Html5FormTag;
import com.titan.services.GenerateCode.v8.ViewXML.tpl.form.FormGridField;
import com.titan.services.GenerateCode.v8.ViewXML.tpl.form.FormGridOption;
import com.titan.services.GenerateCode.v8.ViewXML.tpl.form.InputOption;
import com.titan.services.GenerateCode.v8.ViewXML.tpl.form.LabelOption;
import com.titan.services.GenerateCode.v8.ViewXML.tpl.options.ButtonOption;
import com.titan.services.GenerateCode.v8.ViewXML.tpl.options.CardOption;
import com.titan.services.GenerateCode.v8.ViewXML.tpl.options.PageOption;
import com.titan.services.GenerateCode.v8.common.enums.HtmlInputType;
import com.titan.services.GenerateCode.v8.common.utils.JsBuilderV8;

import sdk.org.apache.shiro.utils.ShiroUtils;


/**
 * This software is Copyright ©2018 ChengGong studio. All Rights Reserved.
 * The source code contained in this listing is proprietary to 周成功工作室.
 * Unauthorized copying, adaptation, distribution, use, or display is strictly prohibited.
 */
@ApiDescription("退出页面")
@ApiAuthor("周成功")
@ApiEmail("86898837@qq.com")
@ApiVersion("1.0.20190220")
@RestController
@SuppressWarnings("static-access")
public class LogoutController extends BaseHtmlV8 {
    @RequestMapping("/logout")
    public void success(HttpServletRequest request, HttpServletResponse response) throws Exception {
        ShiroUtils.logout();
        HtmlTagV8 html = this.tplC8.html("退出成功！<a href=\"/login/page\">登录</a>");
        
        JsBuilderV8 style = JsBuilderV8.$().addLines(this.NULL_LINE);
        JsBuilderV8 script = JsBuilderV8.$().addLines(this.NULL_LINE);
        PageOption spa = this.defaultContext(request, response);
        String htmlFull = this.page(spa, style, script, html);
        this.writeHtml(response, htmlFull);
    }    
}
